/*******************************************************************************
 * Copyright 2011 Alexandre Zglav and Morphiastic
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package com.morphiastic.annotations;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.elasticsearch.common.xcontent.XContentBuilder;

import com.morphiastic.IndexedFieldBridge;
import com.morphiastic.fieldbridge.VoidIndexedFieldBridge;

@Retention( RetentionPolicy.RUNTIME )
@Target( {ElementType.FIELD, ElementType.METHOD} )
@Documented
public @interface ElastiFieldBridge {
	
	/**
	 * lets us declare if we want to fully override the default indexation and mapping generation behavior 
	 * for the related ElastiField (the one to which the annotation is applied) or not
	 * 
	 * if set to true, the normal field mapping creation and the normal field indexation mechanism are bypassed and only the 
	 * fieldBridge actions are taken into consideration
	 * 
	 * if true, it is the FULL responsibility of the IndexedFieldBridge implementation to generate the appropriate mappings in the 
	 * addIndexFieldSettings(XContentBuilder mappingBuilder) method as the regular field mapping definition mechanism is fully overriden
	 * 
	 * 
	 * USE WITH CAUTION
	 * 
	 * if set to false, the normal/regular annotation based mapping is generated before the call to addIndexFieldSettings(XContentBuilder mappingBuilder)
	 * in which the user can add supplementary mapping definitions manually
	 * 
	 * TODO provide an example
	 * 
	 *  defaults to false
	 *  
	 *  
	 * @return
	 */
	boolean fullyOverrideDefault() default false;
	
	
	Class<? extends IndexedFieldBridge> bridgeClass() default VoidIndexedFieldBridge.class; 
	
	Parameter[] params() default {};
	
	String name() default "";
	
}
